async function loginCheck(ctx, next) {
  const userInfo = ctx.session?.userInfo;
  if (userInfo && userInfo.username) {
    await next();
  } else {
    ctx.body = {
      errno: -1,
      message: "需要登录",
    };
  }
}

module.exports = loginCheck;
